<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" pageEncoding="UTF-8" contentType="text/html; UTF-8" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>layout 后台大布局 - Layui</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
	<script src="${pageContext.request.contextPath}/layui/layui.js"></script>
	<script src="${pageContext.request.contextPath}/js/jquery-1.12.4.js"></script>
	<style>
		.layui-tab-content {
			padding: 0; /*layui-tab-content:默认有padding: 10px;的值，因为iframe的绝对定位脱离文档流，所以会存在20px的空白空间*/
		}

		.show-frame {
			top: 50px !important;
			/*默认.layui-layout-admin .layui-body {
                top: 60px;
                bottom: 44px;
            }*/
			overflow: hidden; /*消除浏览器最右边的滚动条*/
		}

		.frame {
			position: absolute;
			padding: 10px; /*与layui-footer隔开一段距离*/
			width: 100%;
			height: 100%;
		}
	</style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
	<div class="layui-header">
		<div class="layui-logo">layui 后台布局</div>
		<!-- 头部区域（可配合layui已有的水平导航） -->
		<ul class="layui-nav layui-layout-left">
			<li class="layui-nav-item"><a href="">控制台</a></li>
			<li class="layui-nav-item"><a href="">商品管理</a></li>
			<li class="layui-nav-item"><a href="">用户</a></li>
			<li class="layui-nav-item">
				<a href="javascript:;">其它系统</a>
				<dl class="layui-nav-child">
					<dd><a href="">邮件管理</a></dd>
					<dd><a href="">消息管理</a></dd>
					<dd><a href="">授权管理</a></dd>
				</dl>
			</li>
		</ul>
		<ul class="layui-nav layui-layout-right">
			<li class="layui-nav-item">
				<a href="javascript:;">
					<img src="http://t.cn/RCzsdCq" class="layui-nav-img">
					${sessionScope.login.adminName}
				</a>
				<dl class="layui-nav-child">
					<dd><a href="">基本资料</a></dd>
					<dd><a href="">安全设置</a></dd>
				</dl>
			</li>
			<li class="layui-nav-item"><a href="${pageContext.request.contextPath}/admin/loginOut">退了</a></li>
		</ul>
	</div>

	<div class="layui-side layui-bg-black">
		<div class="layui-side-scroll">
			<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
			<ul class="layui-nav layui-nav-tree"  lay-filter="test">
				<c:forEach var="d" items="${requestScope.menuList}">
				<li class="layui-nav-item layui-nav-itemed">
					<a class="" href="#">${d.menuName}</a>
					<dl class="layui-nav-child">
					<c:forEach var="p" items="${d.menus}">
						<dd><a href="#" class="a_tab" content="${pageContext.request.contextPath}/${p.menuUrl}" layid="${p.menuId}">${p.menuName}</a></dd>
					</c:forEach>
					</dl>
				</li>
				</c:forEach>
			</ul>
		</div>
	</div>

	<div class="layui-body">
		<%--<!-- 内容主体区域 -->
		<div style="padding: 15px;">内容主体区域</div>--%>
		<div class="layui-tab layui-tab-brief" lay-filter="demo" lay-allowclose="true" >
			<ul class="layui-tab-title">
				<li class="layui-this"><i class="layui-icon">&#xe68e;</i></li>
			</ul>
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					<iframe src="${pageContext.request.contextPath}/index.jsp" class="frame" frameborder="0"></iframe>
				</div>
			</div>
		</div>
	</div>

	<div class="layui-footer">
		<!-- 底部固定区域 -->
		© layui.com - 底部固定区域
	</div>
</div>

<script>
	//JavaScript代码区域
	layui.use(['element'], function(){
		var element = layui.element;
		var $=layui.$;
		$('.a_tab').click(function () {
			var vid=$(this).attr('layid');
			var vcontent=$(this).attr("content");
			var vtitle = $(this).html();
			var isExists= $('li[lay-id=' + vid + ']').length;
			if(isExists==0){
				element.tabAdd('demo',{
					title: vtitle,
					content: '<iframe src=' + vcontent + ' class="frame" frameborder="0"></iframe>',
					id: vid
				})
			};
			element.tabChange('demo', vid);
		});


	});
</script>
</body>
</html>